from functools import reduce
from enum import Enum


class BandColor(str, Enum):
    ACEN = "#808080"
    GNEG = "#E6E6E6"
    GPOS = "#333333"
    GVAR = "#999999"
    STALK = "#BFBFBF"
    GPOS25 = "#B3B3B3"
    GPOS50 = "#808080"
    GPOS75 = "#4D4D4D"
    GPOS100 = "#1A1A1A"
    GPOS33 = "#999999"
    GPOS66 = "#666666"


def is_autosomal_chrom(chrom: str) -> bool:
    chrom_list = list(reduce(lambda x, y: x + y, map(lambda c: [f"{c}", f"chr{c}"], range(1, 24))))
    return chrom in chrom_list


def is_sex_chrom(chrom: str) -> bool:
    return is_x_chrom(chrom) or is_y_chrom(chrom)


def is_x_chrom(chrom: str) -> bool:
    return chrom in ["X", "chrX"]


def is_y_chrom(chrom: str) -> bool:
    return chrom in ["Y", "chrY"]


def is_male(gender: str) -> bool:
    return gender.lower() in ["m", "male", "xy"]


def is_female(gender: str) -> bool:
    return gender.lower() in ["f", "female", "xx"]


def is_active_chrom(chrom: str, gender: str):
    if is_autosomal_chrom(chrom) or is_x_chrom(chrom):
        return True
    if (not is_female(gender)) and is_y_chrom(chrom):
        return True
    return False
